<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">

    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <h:form id="gameSearch" styleClass="edit">
    
        <rich:simpleTogglePanel label="Game search parameters" switchType="ajax">
        
            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">frameDetails</ui:define>
                <h:inputText id="frameDetails" value="#{gameList.game.frameDetails}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">pinDetails</ui:define>
                <h:inputText id="pinDetails" value="#{gameList.game.pinDetails}"/>
            </s:decorate>

        
        </rich:simpleTogglePanel>
        
        <div class="actionButtons">
            <h:commandButton id="search" value="Search" action="/GameList.xhtml"/>
        </div>
        
    </h:form>
    
    <rich:panel>
        <f:facet name="header">Game search results</f:facet>
    <div class="results" id="gameList">

    <h:outputText value="The game search returned no results." 
               rendered="#{empty gameList.resultList}"/>
               
    <rich:dataTable id="gameList" 
                var="game"
              value="#{gameList.resultList}" 
           rendered="#{not empty gameList.resultList}">
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="id #{gameList.order=='id asc' ? messages.down : ( gameList.order=='id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='id asc' ? 'id desc' : 'id asc'}"/>
                </s:link>
            </f:facet>
            #{game.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="alley id #{gameList.order=='alley.id asc' ? messages.down : ( gameList.order=='alley.id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='alley.id asc' ? 'alley.id desc' : 'alley.id asc'}"/>
                </s:link>
            </f:facet>
            #{game.alley.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="crossLane #{gameList.order=='crossLane asc' ? messages.down : ( gameList.order=='crossLane desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='crossLane asc' ? 'crossLane desc' : 'crossLane asc'}"/>
                </s:link>
            </f:facet>
            #{game.crossLane}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="date #{gameList.order=='date asc' ? messages.down : ( gameList.order=='date desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='date asc' ? 'date desc' : 'date asc'}"/>
                </s:link>
            </f:facet>
            #{game.date}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="frameDetails #{gameList.order=='frameDetails asc' ? messages.down : ( gameList.order=='frameDetails desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='frameDetails asc' ? 'frameDetails desc' : 'frameDetails asc'}"/>
                </s:link>
            </f:facet>
            #{game.frameDetails}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="gameBlock id #{gameList.order=='gameBlock.id asc' ? messages.down : ( gameList.order=='gameBlock.id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='gameBlock.id asc' ? 'gameBlock.id desc' : 'gameBlock.id asc'}"/>
                </s:link>
            </f:facet>
            #{game.gameBlock.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="gameDetailLevel #{gameList.order=='gameDetailLevel asc' ? messages.down : ( gameList.order=='gameDetailLevel desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='gameDetailLevel asc' ? 'gameDetailLevel desc' : 'gameDetailLevel asc'}"/>
                </s:link>
            </f:facet>
            #{game.gameDetailLevel}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="gameSet id #{gameList.order=='gameSet.id asc' ? messages.down : ( gameList.order=='gameSet.id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='gameSet.id asc' ? 'gameSet.id desc' : 'gameSet.id asc'}"/>
                </s:link>
            </f:facet>
            #{game.gameSet.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="lane #{gameList.order=='lane asc' ? messages.down : ( gameList.order=='lane desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='lane asc' ? 'lane desc' : 'lane asc'}"/>
                </s:link>
            </f:facet>
            #{game.lane}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="pinDetails #{gameList.order=='pinDetails asc' ? messages.down : ( gameList.order=='pinDetails desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='pinDetails asc' ? 'pinDetails desc' : 'pinDetails asc'}"/>
                </s:link>
            </f:facet>
            #{game.pinDetails}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="player id #{gameList.order=='player.id asc' ? messages.down : ( gameList.order=='player.id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='player.id asc' ? 'player.id desc' : 'player.id asc'}"/>
                </s:link>
            </f:facet>
            #{game.player.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="result #{gameList.order=='result asc' ? messages.down : ( gameList.order=='result desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{gameList.order=='result asc' ? 'result desc' : 'result asc'}"/>
                </s:link>
            </f:facet>
            #{game.result}
        </h:column>
        <h:column>
            <f:facet name="header">action</f:facet>
            <s:link view="/#{empty from ? 'Game' : from}.xhtml" 
                   value="Select" 
                      id="game">
                <f:param name="gameId" 
                        value="#{game.id}"/>
            </s:link>
        </h:column>
    </rich:dataTable>

    </div>
    </rich:panel>
    
    <div class="tableControl">
      
        <s:link view="/GameList.xhtml" 
            rendered="#{gameList.previousExists}" 
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>
        
        <s:link view="/GameList.xhtml" 
            rendered="#{gameList.previousExists}" 
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult" 
                    value="#{gameList.previousFirstResult}"/>
        </s:link>
        
        <s:link view="/GameList.xhtml" 
            rendered="#{gameList.nextExists}" 
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult" 
                    value="#{gameList.nextFirstResult}"/>
        </s:link>
        
        <s:link view="/GameList.xhtml" 
            rendered="#{gameList.nextExists}" 
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult" 
                    value="#{gameList.lastFirstResult}"/>
        </s:link>
        
    </div>
    
    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/GameEdit.xhtml"
                    id="create" 
                 value="Create game">
            <f:param name="gameId"/>
        </s:button>
    </s:div>
    
</ui:define>

</ui:composition>

